import axios from "axios";
import { defineStore } from "pinia";
import { getHomeHotSuggests,getHomeCategories } from '@/services'

export const useHomeStore = defineStore('home',{
  state:() =>({
    homeName:'home',
    counter:100,
    hotDatas:[],
    categories:[]
  }),
  getters:{
    doubleCount: (state) => state.counter * 2,
  },
  actions:{
    async fetchDatas(){
      let res =  await getHomeHotSuggests()
        this.hotDatas = res.data
    },
    async fetchCategories(){
      let res = await getHomeCategories()
      this.categories = res.data
    }
  }
})


export default useHomeStore